﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ProductHomePage.ascx.cs" Inherits="webapp4U.UI.Controls.Usercontrol_ProductHomePage" %>
<%@ Import Namespace="webapp4U" %>
<%@ Register Assembly="webapp4U" Namespace="webapp4U.UI" TagPrefix="webapp4U"  %>
<%@ Register src="~/Usercontrol/ShoppingCart.ascx" tagname="ShoppingCart" tagprefix="uc5" %>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate> 
    <asp:Panel ID="pnProductInCommod" runat="server">       
    <table align="center" width="100%" border="0">
        <tr>
            <td>
                <asp:Repeater runat="server" ID="rptCategoryNotInClass" 
                    onitemdatabound="rptCategoryNotInClass_ItemDataBound">
                <ItemTemplate>
                    <tr>
                        <td class="labwell_title_page margin_bottom">
                            <h4><%# (Eval("Description"))%></h4>
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                             <!-- Begin San Pham -->
                              <asp:DataList ID="ItemsDataList" runat="server" Width="100%" 
                              RepeatDirection="Horizontal" 
                              EnableViewState="False" 
                              DataSource='<%# GetItemsByInCommodKey((string) Eval("InClassKey")) %>'
                              CellPadding="10" 
                              ItemStyle-HorizontalAlign="left"
                              RepeatColumns="3" CssClass="table_product">
                               <ItemTemplate>
                                <table border="0" align="center" width="100%" style="height:100%;">
                                    <tr>
                                        <td>
                                            <a class="margin_all" href="<%=Globals.ApplicationPath %>Page/Products/ProductDetail.aspx?ItemKey=<%#Eval("ItemKey")%>">
                                                <img onmouseover="showtrail('<%=Globals.ApplicationPath %>Page/Products/Image.ashx?Size=L&ImageUrl=<%# Eval("ImageUrl") %>','<%# Eval("Description")%>',500,500)" onmouseout="hidetrail();" border="0" src='<%=Globals.ApplicationPath %>Page/Products/Image.ashx?Size=M&ImageUrl=<%# Eval("ImageUrl") %>' />                                 
                                                <br />
                                                <div class="product_tilte margin_bottom"><%# Eval("Description")%></div>
                                                <span class="product_price margin_bottom"> 
                                                    <%=ResourceManager.GetString("Product_Price") %>: 
                                                    <asp:Label ID="lblPrice" Text='<%#GetPrice((float)Eval("UnitPrice")) %>' runat="server" ></asp:Label>
                                                </span>                                                
                                            </a>
                                            <div class="margin_all">
                                              <%--<input type="button" value="Đặt hàng" class="bt_submit"/>
                                              <input type="button" value="Thêm vào giỏ hàng" class="bt_submit"/>--%>
                                                <webapp4U:Button runat="server" ID="btnProductOrder" Text="Đặt hàng" ResourceName="Product_Order" CssClass="bt_submit" OnClick="btn_ProductOrder_Click" />
                                                <webapp4U:Button ID="btnAddToCart" Text="Thêm vào giỏ hàng" ResourceName="Product_AddToCart" runat="server" CssClass="bt_submit" />
                                               <br />
                                                <asp:Panel runat="server" ID="PanelAddToCart">                                    
                                                
                                                    <input type="hidden" id="txtItemkey" value='<%#Eval("ItemKey")%>' runat="server" />                                 
                                                    <%--<asp:Image ID="testImage" runat="server" CssClass="img" />    --%>                                                                                                     
                                                
                                                </asp:Panel>
                                            </div>
                                        </td>
                                    </tr>                                  
                                </table>
                            </ItemTemplate>
                              </asp:DataList>
                            <!-- End San Pham -->
                        </td>
                    </tr>
                    <tr>
                        <td align="right" style="padding-right: 20px; padding-bottom:3px;">
                            <img src="<%=Globals.ImagesUrl()%>arrow.gif" />
                            <a class="ReadMore" href="<%=Globals.ApplicationPath%>Page/Products/Default.aspx?CommodKey=<%# Eval("InClassKey")%>">
                                    <%=ResourceManager.GetString("ReadMore") %>
                            </a>
                        </td>
                    </tr>
                    <tr><td class="pm_line"></td></tr>
                </ItemTemplate>
                </asp:Repeater>
            </td>
        </tr>
    </table>
       <div align="center">
        <asp:Panel ID="Panel1" Visible="True" runat="server">
            <div align="center">
                <table cellpadding="2" cellspacing="0" border="0" width="100%" align="center">
                    <tr>
                        <td valign="middle" align="center">
                            <webapp4U:Pager ID="Pager1" runat="server" />
                        </td>
                    </tr>
                </table>
            </div>
        </asp:Panel>
    </div>
     </asp:Panel>
    <table align="center" width="100%" border="0">
        <tr>
            <td>
                <asp:Repeater runat="server" ID="rptCategory" 
                    onitemdatabound="rptCategory_ItemDataBound">
                <ItemTemplate>
                    <tr>
                        <td class="labwell_title_page margin_bottom">
                            <h4><%# (Eval("CommodDescription"))%> > <%# (Eval("Description"))%></h4>                       
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                             <!-- Begin San Pham -->
                              <asp:DataList ID="ItemsDataList" runat="server" Width="100%" 
                              RepeatDirection="Horizontal" 
                              EnableViewState="False" 
                              DataSource='<%# GetItemsByInClassKey((string) Eval("InClassKey")) %>'
                              CellPadding="10" 
                              ItemStyle-HorizontalAlign="left"
                              RepeatColumns="3" CssClass="table_product">
                               <ItemTemplate>
                                <table border="0" align="center" width="100%" style="height:100%;">
                                    <tr>
                                        <td class="BorderImage" width="140" height="140" align="center">
                                            <a href="<%=Globals.ApplicationPath %>Page/Products/ProductDetail.aspx?ItemKey=<%#Eval("ItemKey")%>">
                                                <img onmouseover="showtrail('<%=Globals.ApplicationPath %>Page/Products/Image.ashx?Size=L&ImageUrl=<%# Eval("ImageUrl") %>','<%# Eval("Description")%>',500,500)" onmouseout="hidetrail();" border="0" src='<%=Globals.ApplicationPath %>Page/Products/Image.ashx?Size=M&ImageUrl=<%# Eval("ImageUrl") %>' />                                 
                                                <br />
                                                <div class="product_tilte margin_bottom"><%# Eval("Description")%></div>
                                                <span class="product_price margin_bottom"><%=ResourceManager.GetString("Product_Price") %>: 
                                                    <asp:Label ID="lblPrice" Text='<%#GetPrice((float)Eval("UnitPrice")) %>' runat="server" ></asp:Label>
                                                </span>
                                            </a>
                                            <div class="margin_all">
                                                <input type="button" value="Đặt hàng" class="bt_submit"/>
                                                <input type="button" value="Thêm vào giỏ hàng" class="bt_submit"/>
                                            
                                               <br />
                                                <asp:Panel runat="server" ID="PanelAddToCart">                                    
                                                
                                                    <input type="hidden" id="txtItemkey" value='<%#Eval("ItemKey")%>' runat="server" />                                 
                                                    <asp:Image ID="testImage" runat="server" CssClass="img" />                                                                                                         
                                                
                                                </asp:Panel>
                                            </div>
                                        </td>
                                    </tr>                                   
                                    
                                </table>
                            </ItemTemplate>
                              </asp:DataList>
                            <!-- End San Pham -->
                        </td>
                    </tr>
                    <tr>
                        <td align="right" style="padding-right: 20px; padding-bottom:3px;">
                            <img src="<%=Globals.ImagesUrl()%>arrow.gif" />
                            <a class="ReadMore" href="<%=Globals.ApplicationPath%>Page/Products/Default.aspx?InClassKey=<%# Eval("InClassKey")%>">
                                    <%=ResourceManager.GetString("ReadMore") %>
                            </a>
                        </td>
                    </tr>
                    <tr><td class="pm_line"></td></tr>
                </ItemTemplate>
                </asp:Repeater>
            </td>
        </tr>
    </table>
       <div align="center">
        <asp:Panel ID="DisplayPager" Visible="True" runat="server">
            <div align="center">
                <table cellpadding="2" cellspacing="0" border="0" width="100%" align="center">
                    <tr>
                        <td valign="middle" align="center">
                            <webapp4U:Pager ID="Pager" runat="server" />
                        </td>
                    </tr>
                </table>
            </div>
        </asp:Panel>
    </div>

   <%-- <div id="Result"></div>--%>

   </ContentTemplate>
</asp:UpdatePanel>  